package com.juyu.miliao.api.domain;

import com.juyu.miliao.api.validator.CreateQuestionAndAnswerInfoCheck;
import com.juyu.miliao.api.validator.UpdateQuestionAndAnswerInfoCheck;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;


/**
 * 问答信息
 *
 * @author xuanqicheng
 * @create 2018-17-10:18 AM
 */
@Data
public class QuestionAndAnswerInfo{
    /**
     * 主键
     */
    @NotNull(message = "问题Id不能为空",groups = {UpdateQuestionAndAnswerInfoCheck.class})
    private Long id;
    /**
     * 提问者id
     */
    @NotNull(message = "提问者id不能为空",groups = {CreateQuestionAndAnswerInfoCheck.class})
    private Long questionUserId;
    /**
     * 提问内容
     */
    @NotBlank(message = "提问内容不能为空",groups = {CreateQuestionAndAnswerInfoCheck.class})
    @Length(max = 66, message = "提问内容总超度不能超过60",groups = {CreateQuestionAndAnswerInfoCheck.class})
    private String questionContent;

    /**
     * 问题状态：1：待回答，2：以回答  默认为待回答
     */
    private Integer questionStatus;
    /**
     * 指定问题回答人id
     */
    @NotNull(message = "回答人id不能为空",groups = {CreateQuestionAndAnswerInfoCheck.class})
    private Long answerUserId;
    /**
     * 回答审批状态0：未审批,1：审批通过，2：审批不通过 默认为审批通过
     */
    private Integer answeApprovalType;
    /**
     * 回答语音保存地址
     */
    @NotBlank(message = "语音地址不能为空",groups = {UpdateQuestionAndAnswerInfoCheck.class})
    private String answerUrl;
    /**
     * 语音时长,单位秒,时间大于5秒
     */
    @NotNull(message = "语音时长不能为空",groups = {UpdateQuestionAndAnswerInfoCheck.class})
    @Min(value = 5,message = "语音时长小于5秒请重新录制",groups = {UpdateQuestionAndAnswerInfoCheck.class})
    private Integer answerTime;

    /**
     * 创建时间 yyyy-MM-dd HH:mm:ss
     */
    private LocalDateTime createTime;
    /**
     * 创建日期 yyyy-MM-dd
     */
    private LocalDate createDate;


}
